<%- include header%>
	<script>
		$(function(){
			$("#login").click(function(){
				var data={};
				var name=$("#name").val();
				var password=$("#password").val();
				if(name && password){
					data.name=name;
					data.password=password;
				}else{
				$("#tips").text("您可能忘记填啥了!");
				return false;
				}
				$.ajax({
					type:"POST",
					data:JSON.stringify(data),
					contentType:'application/json',
					url:'/login',
					success:function(data){
						if(data.success==4){
						$("#tips").text("该用户名不存在!");
						}
						if(data.success==3){
						$("#tips").text("密码不正确!");
						}
						if(data.success==1){
						window.location.href="/index";
						}
									
					}
				});
			});


			$("#reg").click(function(){
				var data={};
				var name=$("#name").val();
				var password=$("#password").val();
				if(name && password){
					data.name=name;
					data.password=password;
				}else{
				$("#tips").text("亲，请在下方输入您的昵称和密码，点击注册，就可以直接注册咯！");
				return false;
				}
				$.ajax({
					type:"POST",
					data:JSON.stringify(data),
					contentType:'application/json',
					url:'/reg',
					success:function(data){
						if(data.success==4){
						$("#tips").text("用户已经被如花注册！");
						}
						if(data.success==3){
						$("#tips").text("用户已经被如花注册!");
						}
						if(data.success==1){
						window.location.href="/index";
						}
					}
				});
			});


		});
	</script>

     <div id="ad">
          <div class="thumbnail">
            <img src="../images/enter.png" style="width:200px;height:200px" class="img-responsive">
     	   <div class="caption">
     	  	<h4 class="text-center">EasyOTO｜关注互联网创业</h4>
     	   </div>
     	  </div>
     </div>
     <dic id="logreg">
     <div class="alert alert-success">
  		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  		<strong>EasyOTO极大简化了注册流程，只需要输入手机号或者密码即可立即注册并且登录</strong> 
	 </div>
	 <span id="tips" class="tips"></span>
     <div class="container">
     	<div class="row">
						<div class="input-group col-xs-12" >
						  <span class="input-group-addon"><i class="fa fa-mobile fa-fw"></i></span>
						  <input class="form-control" type="text" id="name" placeholder="请输入您的手机号或昵称">
						</div>
		</div>
		<hr>
		<div class="row">
						<div class="input-group col-xs-12" >
						  <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
						  <input class="form-control" type="password" id="password" placeholder="请输入你的密码">
						</div>
		</div>
		<hr>
		<div class="row">
			<button id="login" class="btn btn-primary col-xs-12">登录</button>
		</div>
		<hr>
		<div class="row">
			<button id="reg" class="btn btn-success col-xs-12">没有账号？立即注册</button>
		</div>	
	

     </div>	   
     </div>

<%- include nav%>
<%- include footer%>